package cntr.memoryspace;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by Thanh-Trung Pham.
 */
public class MemorySpace {
    private String m_strName;

    Map<String, MemoryObject> m_oMembers = new HashMap<>();

    public MemorySpace(String name) {
        m_strName = name;
    }

    public MemoryObject get(String id) {
        return m_oMembers.get(id);
    }

    public void put(String id, MemoryObject value) {
        m_oMembers.put(id, value);
    }

    @Override
    public String toString() {
        return m_strName + ":" + m_oMembers;
    }

    public Collection<MemoryObject> getAllMemoryObjects(){
        return m_oMembers.values();
    }
}
